package com.wdb007.venus.svc.facade.constant;

public enum RspCodeEnum {
	
	
	/** 系统异常 */
	CODE_SYS_ERROR(1010080099, "系统异常，请联系管理员"),
	
	USER_ISNOT_UNION_WXUSER(1020000001, "用户未绑定手机号"),

	USER_TOKEN_IS_UNVALID(1010070010, "token验证失败"),
	USER_ID_IS_NULL(1010070014, "用户ID不能为空"),
	/**发送短信验证码时异常*/
	/**手机短信发送成功*/
	SMS_SEND_SUCCESS(1010070009, "短信验证码发送成功") ,
	/** 手机号码不能为空 */
	MOBILE_IS_UNVALID(1010070004, "手机号码校验非法"),
	/** 短信发送失败*/
	SMS_SEND_FAILED(1010070005, "短信发送失败，请重新获取验证码"),
	
	/**获取用户最新信息时异常*/
	/** 用户不存在*/
	USER_NOT_FOUND(1010070001, "用户不存在") ,
	/** 用户被锁定*/
	USER_IS_LOCKED(1010070002, "用户被冻结，请联系客服"),
	/** token不能为空*/
	TOKEN_IS_NULL(1010070003, "token不能为空") ,
	
	/** 短信验证码验证超过五次，需要重新获取验证码 */
	VERIFY_CODE_FIVE_TIMES(1010070006, "验证超过五次，请重新获取验证码"),
	/** 短信验证码错误 */
	VERIFY_CODE_IS_WRONG(1010070007, "验证码错误"),
	/** 短信验证码失效 */
	VERIFY_CODE_IS_INVALID(1010070008, "验证码失效,请重新获取验证码"),
	
	/** 未缴纳押金*/
	ACCOUNT_DEPOSIT_IS_NULL(1010060001, "未缴纳押金，请先缴纳押金"),
	/** 账户余额不足 */
	ACCOUNT_IS_NOT_ENOUGH(1010060002, "余额不足1元，请先充值"),
	/** 用户正在开柜，不能再次进行开柜操作 */
	USER_IS_OPENING_GRID(1010050001, "用户正在开柜，不能再次进行开柜操作"),

	BORROWING_COUNT_OVER_10(1010050002, "在借图书超过10本，开锁失败"),
	
	BORROWING_IS_NOT_IN_CURRENT_GRID(1010050003, "在借图书不在当前书格中，开锁失败"),
	
	BOOKSHELF_IS_UNDER_DAMAGE(1010050004, "当前书柜处理报修状态，不能使用"),
	
	BOOKSHELF_IS_ALREADY_EXISTS(1010050020, "书柜已存在,不能再次初始化操作."),
	BOOKSHELF_IS_NOT_EXISTS(1010050005, "当前书柜不存在"),
	
	BOOKSHELF_IS_UNAVAILABLE(1010050006, "当前书柜不可用"),
	
	BOOK_GRID_IS_NOT_EXISTS(1010050007, "当前书格不存在"),
	
	BOOK_GRID_IS_UNDER_DAMAGE(1010050008, "当前书格已报修"),
	
	BOOK_GRID_IS_UNDER_NON_CLOSED(1010050009, "当前书格处于非关闭状态"),
	
	BOOK_GRID_IS_UNAVAILABLE(1010050010, "当前书格不可用"),
	
	BOOK_GRID_IS_UNDER_NON_INVENTORY(1010050011, "当前书格处于非盘点成功状态，不能进行再次盘点"),
	
	BOOK_GRID_FINALLY_USED_NON_OWN(1010050012, "书格最后一次操作并非本人，不能进行再次盘点"),
	
	BOOK_GRID_LAST_USED_NOT_THIS(1010050013, "您最后开启的并非是该书格，不能进行再次盘点"),
	
	BOOK_GRID_OVER_5_MINUTES(1010050014, "距离你最后操作该书格超过5分钟，不能进行再次盘点"),
	
	BOOK_SHELF_IS_OPEN(1010050015, "当前书柜正在有人使用，请稍后再使用"),
	/** 查询记录为空 */
	QUERY_LIST_IS_NULL(1010080002, "查询记录为空 "),
	
	PARAM_CHECK_IS_NULL(1010080001, "请求参数[%s]不能为空"),
	/** %s 不存在 */
	OBJ_NOT_FOUND(1010080003, "对象[%s]不存在") ,

	BOOK_GRID_STATUS_IS_NON_OPENED(1010050015, "书格当前状态为非打开状态，请刷新后再操作"),
	
	BOOK_GRID_STATUS_IS_NON_CLOSED(1010050016, "书格当前状态为非关闭状态，请刷新后再操作"),
	
	BOOK_GRID_CANNOT_BE_REPORTED(1010050017, "该书格由本人已经报修两次，不能再次报修该书格"),
	
	BOOK_SHELF_HAS_BEAN_REPORTED(1010050018, "该书柜由本人已经报修过，不能再次报修，请联系客服"),
	/** 书格相关错误码 */
	
	ACTIVE_DATAVER_IS_INVALID(1010080004, "datever字段不合法，目前只能为1"),
	
	ACTIVE_DEVICETOEKN_IS_NOT_EXISTS(1010080005, "devicetoken不存在"),
	
	ACTIVE_DATA_IS_INVALID(1010080006, "激活时传递的数据不正确，解密失败"),
	
	ACTIVE_DATA_IS_ARRAY(1010080007, "激活时传递的数据不正确，解密成数组"),

	QRCODE_ANALYSIS_IS_WRONG(1010080008, "该二维码解析不正确，请重新扫码"),
	
	REQUEST_CHECK_FAILURE(1010080009, "该请求验签失败"),
	
	CALL_ALIPAY_ERROR(1010060003, "调用支付宝接口异常"),
	
	CALL_ALIPAY_REFUND_ERROR(1010060004, "调用支付宝退款接口异常"),
	
	CALL_ALIPAY_PARAM_ERROR(1010060024, "参数异常,请检查输入的参数"),
	
	REFUND_CASH_IS_LT_ZERO(1010060005, "余额为负，不能进行退款"),
	
	REFUND_CAN_NOT(1010060006, "当前有在借图书，不能进行退款"),
	
	REFUND_AUDIT_STATUS_INVALID(1010060007, "该笔交易不处于准备退款阶段，请重新提交退款申请"),
	REFUND_NO_DEPOSIT(1010060008, "用户无押金可退"),
	REFUND_HAS_SUBMITTED(1010060009, "您的退款申请已提交"),
	REFUND_IS_REFUSED(1010060010, "您的退款申请被拒绝，请联系客服"),
	REFUND_AUDIT_SUCCESS(1010060011, "您的退款审核已经成功"),
	
	REFUND_AUDDIT_NOT_PASSED(1010060013, "该笔交易还未通过退款审核"),
	REFUND_AUDDIT_FAILED(1010060014, "该笔交易退款失败"),
	REFUND_AUDDIT_REFUSED(1010060015, "该笔交易退款审核被拒绝"),
	REFUND_SUCCESS(1010060016, "该笔交易已退款成功"),
	
	WX_GET_OPENID_FAILED(1010060012, "获取openId失败，请联系管理员"),
	
	ISBN_AND_IS_BOTH_NULL(1010020001, "isbn或id不能都为空"),
	
	SHELF_CODE_IS_BOTH_NULL(1010020002, "shelf_code或其他参数不能同时为空"),
	
	STAFF_LOGIN_NAME_OR_PWD_IS_EMPTY(4, "登陆用户名或密码不能为空"),
	STAFF_LOGIN_PWD_IS_INVALID(2, "密码不匹配"),
	STAFF_LOGIN_NAME_IS_INVALID(1, "账户名输入错误"),
	STAFF_TRANS_IS_NOT_EXISTS(3, "该条记录不存在"),
	
	HAS_NOT_PUTON_BOOK(40, "没有新的上架图书"),
	
	BOOK_INFO_NOT_EXISTS(2, "图书信息不存在"),
	
	BOOK_COMMENTS_OVER_500(1010030001, "评论字数超过500字，不能保存"),
	
	CARD_CHARGE_CODE_IS_WRONG(1010070011, "充值码错误，请重新输入"),
	CARD_CHARGE_IS_INVAILD(1010070012, "充值码已失效"),
	CARD_CHARGE_IS_USED(1010070013, "您已经使用过该充值码，不能再次使用"),
	
	USER_IS_NOT_SUITED(1010070015, "该家庭成员不属于当前用户，不能进行修改"),
	
	WX_AES_ERROR(1010070016,"微信解密失败"),
	
	CONFIG_KEY_IS_NULL(1010070017, "配置表key不能为空"),
	
	COUPON_DRAW_UP_LIMIT(1010070019, "该优惠券领取次数已达上线，不能领取"),
	COUPON_DRAW_PER_LIMIT(1010070020, "该优惠券用户领取次数已达上线，不能再次领取"),
	COUPON_HAS_OUTLINE(1010070021, "该优惠券已下架，不能领取"),
	
	COUPON_USER_IS_NOT_NEW(1010070022, "该用户不属于新用户，不能领取新人券"),
	
	BUY_BOOK_NOT_USED(1010070023, "抱歉！系统正在维护，购买功能暂不能使用。"),
	WX_OPENID_NOT_FOUND(1010070018, "根据用户id获取不到OPENID");
	/** 返回码 */
	private int rspCode;

	/** 返回码描述 */
	private String rspMsg;

	RspCodeEnum() {
	}

	RspCodeEnum(int rspCode, String rspMsg) {
		this.rspCode = rspCode;
		this.rspMsg = rspMsg;
	}

	public int getRspCode() {
		return rspCode;
	}

	public void setRspCode(int rspCode) {
		this.rspCode = rspCode;
	}

	public String getRspMsg() {
		return rspMsg;
	}

	public void setRspMsg(String rspMsg) {
		this.rspMsg = rspMsg;
	}

	public String getRspMsg(Object... args) {
		return String.format(this.rspMsg, args);
	}
	
	public RspCodeEnum setRspMessage(Object... args) {
		if(this.rspMsg.contains("[") && this.rspMsg.contains("]"))
			this.rspMsg = this.rspMsg.substring(0, this.rspMsg.indexOf("[") + 1) + "%s" + this.rspMsg.substring(this.rspMsg.indexOf("]"));
		this.rspMsg = String.format(this.rspMsg, args);
		return this;
	}
}
